{{ template "head" .Global}}
<div id="table-datatables">
    <h4 class="header">权限信息列表 <a href="#addprems" class="btn dropdown-button waves-effect waves-light modal-trigger"
                                 style="float:right">添加</a>
    </h4>
</div>

{{range $k,$v :=$.RoleAll}} <!--循环角色-->
<div id="ui-alert" class="section">
    <div class="row">
        <!--SIMPLE-->
        <div class="col s12 m4 l12">
            <p><strong>角色：{{$v.role_name}}</strong></p>  <!--角色名称-->

            {{range $k1,$v1 :=$.PremsAll}}    <!--循环权限表-->

            {{if eq $v1.role_id $v.id}}     <!--判断权限列表角色ID 是否为当前角色-->


            {{ range $k2,$v2 :=$.Global.MenuInfoAll}}
            {{if eq $v1.menu_id $v2.id}}
            <div id="card-alert" class="card light-blue lighten-5 col s12 m4 l2" title="点击删除该权限">
                <div class="card-content light-blue-text">

                    {{ range $k3,$v3 :=$.Global.MenuInfoAll}}{{if eq $v3.id $v2.superior_menu}}
                    <p>{{$v3.menu_name}}/{{$v2.menu_name}}</p>
                    {{end}} {{end}}

                </div>
                <button type="button" class="close deep-purple-text" data-dismiss="alert" aria-label="Close">
                    <span aria-hidden="true"><a onclick="sys_post_role_pre_del({{$v1.id}})">×</a></span>
                </button>
            </div>
            {{end}}
            {{end}}
            {{end}}
            {{end}}

        </div>


    </div>
    <div class="divider"></div>
</div>
{{end}}


</section>

{{ template "foot" .Global}}


<div id="addprems" class="modal">
    <form role="form">
        <div class="modal-content">
            <div class="row">
                <p>
                    <strong>添加权限</strong>
                </p>
            </div>

            <div class="row">
                <div class="input-field col s6">
                    <label></label>
                    <select name="menu_id" id="role_id">
                        <option value="" disabled selected>选择角色</option>
                        {{range $k,$v :=$.RoleAll}}
                        <option value="{{$v.id}}">{{$v.role_name}}</option>
                        {{end}}
                    </select>
                </div>

                <div class="input-field col s6">
                    <label></label>
                    <select name="menu_id" id="menu_id">
                        <option value="" disabled selected>选择菜单</option>
                        {{range $k,$v :=$.Global.MenuInfoAll}}{{if eq $v.menu_grade "2"}}
                        {{ range $k3,$v3 :=$.Global.MenuInfoAll}}{{if eq $v3.id $v.superior_menu}}

                        <option value="{{$v.id}}">{{$v3.menu_name}}/{{$v.menu_name}}</option>

                        {{end}}{{end}}
                        {{end}}{{end}}
                    </select>
                </div>

            </div>
        </div>

        <div class="modal-footer">
            <a class="waves-effect waves-red btn-flat modal-action modal-close">关闭</a>
            <a class="waves-effect waves-green btn-flat modal-action" onclick="sys_post_role_pre_add()">保存</a>
        </div>
    </form>
</div>


<!-- ================================================
Scripts
================================================ -->
<script type="text/javascript" src="/statics/js/function.js"></script>
<!-- jQuery Library -->
<script type="text/javascript" src="/statics/js/plugins/jquery-1.11.2.min.js"></script>
<!--angularjs-->
<script type="text/javascript" src="/statics/js/plugins/angular.min.js"></script>
<!--materialize js-->
<script type="text/javascript" src="/statics/js/materialize.min.js"></script>
<!--prism -->
<script type="text/javascript" src="/statics/js/plugins/prism/prism.js"></script>
<!--scrollbar-->
<script type="text/javascript" src="/statics/js/plugins/perfect-scrollbar/perfect-scrollbar.min.js"></script>
<!-- chartist -->
<script type="text/javascript" src="/statics/js/plugins/chartist-js/chartist.min.js"></script>
<!--nestable -->
<link href="/statics/js/plugins/jquery.nestable/nestable.css" type="text/css" rel="stylesheet"
      media="screen,projection">
<!--plugins.js - Some Specific JS codes for Plugin Settings-->
<script type="text/javascript" src="/statics/js/plugins.min.js"></script>
<!--custom-script.js - Add your own theme custom JS-->
<script type="text/javascript" src="/statics/js/custom-script.js"></script>
<!--sweetalert -->
<script type="text/javascript" src="/statics/js/plugins/sweetalert/sweetalert.min.js"></script>


<script type="text/javascript">
</script>


</body>

</html>

